using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;

using HadronData;

namespace Hadron
{
    class GameContext
    {
        private Game m_game;
        private StorageDevice m_storageDevice;
        private int m_nCurrentLevel;
        private World m_world;
        private int m_nLives;
        private String m_strName;
        private int m_nScore;

        private void OnStorageDeviceSelectorVisible(IAsyncResult p_asyncResult)
        {
            m_storageDevice = Guide.EndShowStorageDeviceSelector(p_asyncResult);
            if (!m_storageDevice.IsConnected)
                m_storageDevice = null;
        }

        public GameContext(Game p_game)
        {
            m_game = p_game;
            m_nCurrentLevel = 0;
            m_world = null;
            m_strName = "";
            m_nLives = 3;
            m_nScore = 0;

            Guide.BeginShowStorageDeviceSelector(OnStorageDeviceSelectorVisible, null);
        }

        public Game Game
        {
            get { return m_game; }
        }

        public StorageDevice StorageDevice
        {
            get { return m_storageDevice; }
        }

        public World World
        {
            get { return m_world; }
            set { m_world = value; }
        }

        public int CurrentLevel
        {
            get { return m_nCurrentLevel; }
            set { m_nCurrentLevel = value; }
        }

        public int Lives
        {
            get { return m_nLives; }
            set { m_nLives = value; }
        }

        public String Name
        {
            get { return m_strName; }
            set { m_strName = value; }
        }

        public int Score
        {
            get { return m_nScore; }
            set { m_nScore = value; }
        }
    }
}
